trigger AccountNameOnPO on Purchase_Object__c (before update,before insert) {
Set<Id> poId = new Set<id>();
Set<Decimal> orno= new Set<Decimal>();
List<Id> AcID = new List<Id>();
List<Id> poOwId = New List<Id>();
for (Purchase_Object__c po : Trigger.new){
     poId.add(po.id);
     orno.add(po.Oracle_Acc_Number__c);
    }
Map<id,Purchase_Object__c> mappo = new map<id,Purchase_Object__c>([Select OwnerId from Purchase_Object__c where id in :poId]);
System.debug('pomap' + mappo);
List<Account> Accounts = [Select OwnerId,id,Oracle_Account_Number__c from account where Oracle_Account_Number__c in : orno];
System.debug('Accccc' + Accounts);
Map<id,Account> mapoNid = new Map<id,Account>([Select Name,Ownerid,Oracle_Account_Number__c from Account where  id In : Accounts]);
System.debug('map' + mapoNid);   
 for(Account a : Accounts){                
      for(Purchase_Object__c po :Trigger.New){
             AcID.add(a.Id);
             if(po.Oracle_Acc_Number__c == a.Oracle_Account_Number__c){
             po.Account_name__c =  mapoNid.get(a.Id).Name; 
            System.debug('acccid'   +   po.OwnerId);             
       }
      }     
     }
   }